unix-ffi/ffilib/ffilib.py: Extend libc versions range.#1122
Open
agatti wants to merge 1 commit into
Open
Conversation
This commit extends the range of libc library versions that are looked up when required by user code. FreeBSD 14.1-RELEASE and later versions require an update to the range since they bumped up their libc major version, from 6 to 7. This has the side-effect of guaranteeing at least one failed lookup on modern Linux systems, where the libc is still at version 6. With updated FreeBSD support in MicroPython core, now `sys.platform` properly returns `freebsd`. This required a minor change in the code deciding whether to look for `.so`, `.dylib`, or `.dll` files, since `linux` is no longer the default fallback for generic unix systems. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends the range of libc library versions that are looked up when required by user code.
FreeBSD 14.1-RELEASE and later versions require an update to the range since they bumped up their libc major version, from 6 to 7. This has the side-effect of guaranteeing at least one failed lookup on modern Linux systems, where the libc is still at version 6.
With updated FreeBSD support in MicroPython core, now
sys.platformproperly returnsfreebsd. This required a minor change in the code deciding whether to look for.so,.dylib, or.dllfiles, sincelinuxis no longer the default fallback for generic unix systems.(Hopefully) closes #962.
Testing
Using an interpreter built from MicroPython git
masterwithrequire("ffilib")added to the manifest,import ffilib; ffilib.libc()was called making sure the function returned a validffimodobject.This was done manually both on a current Arch Linux/x64 system and on a FreeBSD 15.0-RELEASE x64 VM.
Trade-offs and Alternatives
This comes with a 13 bytes increase, mostly to hold the
freebsdstring in the MPY file itself.Generative AI
I did not use generative AI tools when creating this PR.